package com.YCH.behavior.controller.v1;

import com.YCH.apis.behavior.apis.BehaviorControllerApi;
import com.YCH.behavior.service.*;
import com.YCH.model.article.dtos.AppPublicArticleDto;
import com.YCH.model.article.dtos.AppUserArticleCategoryDto;
import com.YCH.model.article.pojos.TbArticleCategory;
import com.YCH.model.behavior.dtos.*;
import com.YCH.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/behavior")
@SuppressWarnings("all")
public class BehaviorController implements BehaviorControllerApi {

    @Autowired
    private AppShowBehaviorService appShowBehaviorService;
    @Autowired
    private AppLikesBehaviorService appLikesBehaviorService;
    @Autowired
    private AppUnLikesBehaviorService appUnLikesBehaviorService;
    @Autowired
    private AppReadBehaviorService appReadBehaviorService;
    @Autowired
    private AppCollectionBehaviorService appCollectionBehaviorService;

    @Autowired
    private AppCommentBehaviorService appCommentBehaviorService;
    @Autowired
    private AppCommentReplayBehaviorService appCommentReplayBehaviorService;
    @Autowired
    private AppPublicArticleBehaviorService appPublicArticleBehaviorService;
    @Override
    @PostMapping("/show_behavior")
    public ResponseResult saveShowBehavior(@RequestBody ShowBehaviorDto dto) {
        return appShowBehaviorService.saveShowBehavior(dto);
    }

    @Override
    @PostMapping("/view_article_behavior")
    public ResponseResult saveArticleBehavior(@RequestBody ViewArticleDto dto) {
        return appShowBehaviorService.saveViewArticleBehavior(dto);
    }

    @Override
    @PostMapping("/like_behavior")
    public ResponseResult saveLikesBehavior(@RequestBody LikesBehaviorDto dto) {
        return appLikesBehaviorService.saveLikesBehavior(dto);
    }

    @Override
    @PostMapping("/unlike_behavior")
    public ResponseResult saveUnLikesBehavior(@RequestBody UnLikesBehaviorDto dto) {
        return appUnLikesBehaviorService.saveUnLikesBehavior(dto);
    }

    @Override
    @PostMapping("/read_behavior")
    public ResponseResult saveReadBehavior(@RequestBody ReadBehaviorDto dto) {
        return appReadBehaviorService.saveReadBehavior(dto);
    }

    @Override
    @PostMapping("/collection_behavior")
    public ResponseResult saveCollectionBehavior(@RequestBody CollectionBehaviorDto dto) {
        return appCollectionBehaviorService.saveCollectionBehavior(dto);
    }

    @Override
    @PostMapping("/comment")
    public ResponseResult userComment(@RequestBody userCommentDto dto) {
        return appCommentBehaviorService.comment(dto);
    }

    @Override
    @PostMapping("/save_comment_replay")
    public ResponseResult saveUserCommentReplay(@RequestBody userCommentReplayDto dto) {
        return appCommentReplayBehaviorService.commentReplay(dto);
    }
    /**
     * 发布文章
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/public")
    public ResponseResult UserPublicArticle(@RequestBody AppPublicArticleDto dto) {
        return appPublicArticleBehaviorService.UserArticlePublic(dto);
    }
}
